<template>
  <el-select :value="value" placeholder="请选择频道" clearable @change="changeChannel">
    <el-option v-for="item in channelOptions" :key="item.id" :label="item.name" :value="item.id">
    </el-option>
  </el-select>
</template>

<script>
export default {
  name: 'GeekChannel',
  props: {
    value: {
      type: Number,
      default: 0
    }
  },
  data () {
    return {
      channel_id: 0,
      channelOptions: []
    }
  },
  methods: {
    changeChannel (value) {
      this.$emit('input', value)
    }
  },
  created () {
    // 获取频道列表
    this.$http.get('/v1_0/channels').then(res => {
      this.channelOptions = res.data.data.channels
    })
  }
}
</script>

<style scoped lang="less"></style>
